package com.hackerrank.challenges.detecthtmltags;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Solution {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		in.nextLine();
		Set<String> t = new HashSet<String>();
		for(int n = 0; n < N; n++) {
			String s = in.nextLine();
			Matcher m = Pattern.compile("<[a-zA-Z][a-zA-Z0-9]*").matcher(s);
			while(m.find()) {
				String is = m.group();
				t.add(is.substring(1));
			}
		}
		String[] a = new String[t.size()];
		a = t.toArray(a);
		Arrays.sort(a);
		if(a.length > 0) {
			for(int i = 0; i < a.length - 1; i++)
				System.out.print(a[i] + ";");
			System.out.println(a[a.length - 1]);
		}
	}
}
